<style>
  .ivu-input[disabled], fieldset[disabled] .ivu-input {
    background-color: white;
    opacity: 1;
    cursor: not-allowed;
    color: #515A6E;
  }
  .ivu-select-disabled .ivu-select-selection {
    background-color: white;
    opacity: 1;
    cursor: not-allowed;
    color: #515A6E;
  }
  .ivu-select-input[disabled] {
    cursor: not-allowed;
    color: #515A6E;
    -webkit-text-fill-color: #515A6E;
}
</style>
<template>
    <div class="form-block-inner">
      <Form :model="formInfo" label-position="top" ref="addBaseForm">

        <div class="title-style">查询条件</div>
        <Row :gutter="16">
          <Col span="6">
            <FormItem label="订单编号" >
              <Input type="text" v-model="formInfo.code" placeholder="订单编号"/>
            </FormItem>
          </Col>
          <Col span="3">
            <Button type="primary" class="save-btn mr20" long @click="findMMDLPullList ()">查 询</Button>
          </Col>
        </Row>
        <div class="title-style">基本信息</div>
        <Table border :columns="columns" :data="data"></Table>
      </Form>
    </div>
</template>
<script>
import { updateCreateOrderState0, findMMDLPullList } from '@/api/eventlist'

export default {
  name: 'index',
  data () {
    return {
      formInfo: {
        code: ''
      },
      data: [],
      columns: [
        {
          title: '订单编号',
          key: 'code'
        },
        {
          title: '订单状态',
          key: 'state'
        },
        {
          title: '标题',
          key: 'title'
        },
        {
          title: '姓名',
          key: 'name'
        },
        {
          title: '身份证号',
          key: 'cardno'
        },
        {
          title: '推送类型',
          key: 'process_no_name'
        },
        {
          title: '同步状态',
          key: 'is_creart_order_name'
        },
        {
          title: '操作',
          width: 150,
          align: 'center',
          render: (h, params) => {
            console.log(params, 'ccccccc')
            if (params.row.is_creart_order > 1) {
              return h('div', [
                h('Button', {
                  props: {
                    type: 'primary',
                    size: 'small'
                  },
                  style: {
                    marginRight: '5px'
                  },
                  on: {
                    click: () => {
                      this.updateCreateOrderState0(params.row.id)
                    }
                  }
                }, '重新同步')
              ])
            }
          }
        }
      ]
    }
  },
  methods: {
    findMMDLPullList () {
      var param = {
        code: this.formInfo.code
      }
      findMMDLPullList(param).then(res => {
        if (res.data.errcode === 0) {
          this.data = res.data.data
        } else {
          this.$Notice.error({ title: res.data.errmsg })
        }
        console.log(this.formInfo)
      })
    },
    updateCreateOrderState0 (id) {
      console.log(this.formInfo.id)
      var param = {
        id: id
      }
      updateCreateOrderState0(param).then(res => {
        if (res.data.errcode === 0) {
          this.$Notice.success({ title: '成功' })
          this.findMMDLPullList()
        } else {
          this.$Notice.success({ title: '失败' })
        }
      })
    }
  }
}
</script>

<style scoped>
  .title-style {
    padding: 8px 12px;
    background-color: #ecf8ff;
    border-radius: 4px;
    border-left: 5px solid #50bfff;
    margin: 15px 0;
    font-size: 16px;
    width: 100%;
  }
  .table-mr5 {
    margin-right: 5px;
  }
  .add-btn {
    float: right;
    font-size: 15px;
  }
  .save-btn {
    margin: 20px;
    floaat: right;
  }
  .mr20 {
    margin-right: 20px;
  }
  .bench_search {
    margin-bottom: 10px;
  }
  .help-tip {
    cursor:pointer;
    color: #5cadff;
  }
  .red-star {
    font-family: SimSun;
    color: #f00;
    margin-right: 4px;
  }
</style>
